<template>
  <div id="drivermanage">
    <h1 class="titleTag">司机管理</h1>
    <el-form :inline="true" :model="ruleForm" ref="ruleForm" class="mt24">
      <el-form-item>
        <el-input v-model="ruleForm.name" placeholder="司机姓名" size="small"></el-input>
      </el-form-item>
      <el-form-item>
        <el-select style="width: 144px;" v-model="ruleForm.value1" placeholder="审核状态" size="small">
          <el-option width="100" v-for="item in ruleForm.options1" :key="item.value" :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="创建时间">
        <el-form-item>
          <el-date-picker type="datetime" placeholder="请选择创建时间" v-model="ruleForm.time" default-time="12:00:00"
            style="width: 100%;" size="small"></el-date-picker>
        </el-form-item>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" size="small">查询</el-button>
      </el-form-item>
      <el-form-item>
        <el-button size="small" @click="resetForm('ruleForm')">清空</el-button>
      </el-form-item>
      <el-form-item>
        <el-button size="small">新增</el-button>
      </el-form-item>
    </el-form>
    <div class="tableDetail">
      <el-table :data="tableData" height="634" border style="width: 100%;">
        <el-table-column header-align="center"  label="司机信息" min-width="250">
          <template slot-scope="data">
            <div class="fb"><span>姓名</span><span>{{ data.row.number1 }}</span></div>
            <div class="fb"><span>手机号</span><span>{{ data.row.number2 }}</span></div>
            <div class="fb"><span>性别</span><span>{{ data.row.number3 }}</span></div>
          </template>
        </el-table-column>
        <el-table-column header-align="center" align="center" label="所属承运商" min-width="280" prop="number4"></el-table-column>
        <el-table-column header-align="center" align="center" label="审核状态" min-width=""  prop="number7"></el-table-column>
        <el-table-column header-align="center" align="center" label="驾驶证类型" min-width="140"  prop="number8" class="BLUE"></el-table-column>
        <el-table-column header-align="center" label="证件查看" min-width="186">
          <template slot-scope="scope">
            <div class="fb"><span>行驶证</span><el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button></div>
            <div class="fb"><span>从业资格证</span><el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button></div>
          </template>
        </el-table-column>
        <el-table-column header-align="center" align="center" label="信用评估" min-width=""  prop="number9"></el-table-column>
        <el-table-column header-align="center" align="center" label="创建时间" min-width="186"  prop="number16"></el-table-column>

        <el-table-column header-align="center" align="center" label="操作" min-width="100">
          <template slot-scope="scope">
            <!-- <div><el-button type="text" size="small">停用</el-button></div>
            <div><el-button @click="deleteSure(scope.row)" type="text" size="small">删除</el-button></div> -->
            <div>
              <el-button type="text" size="small" @click="deleteSure(scope.row)">
                <router-link tag="i" :to="{path:'/driverupload',query:{id: scope.row.driid}}">编辑</router-link>
              </el-button></div>
            <div><el-button type="text" size="small">审核</el-button></div>
            <!-- <div><el-button type="text" size="small">绑定车辆</el-button></div>
            <div><el-button type="text" size="small">解除绑定</el-button></div> -->
          </template>
        </el-table-column>
      </el-table>
    </div>

    <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
      <span>确定要删除吗</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="资格证" :visible.sync="dialogTableVisible">
      <img style="width:100%: overflow: hidden"
        src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1575982342296&di=9887afb312914ae41a047a4d15c62c30&imgtype=0&src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20190129%2Fa05e6d1a31734b54a3e139795ca06a4e.jpeg"
        alt="" srcset="">
    </el-dialog>
  </div>
</template>

<script>
import { apiDriverList } from "@/utils/api";
export default {
  name: "drivermanage",
  data() {
    return {
      dialogVisible: false,
      dialogTableVisible: false,
      ruleForm: {
        name: "",
        value1: "",
        options1: [
          {
            value: "待审核",
            label: "待审核"
          },
          {
            value: "通过",
            label: "通过"
          },
          {
            value: "驳回",
            label: "驳回"
          }
        ],
        time: "",
      },
      tableData: [
        // {
        //   status: "待受理",
        //   number1: "张登",
        //   number2: "18888888888",
        //   number3: "男",
        //   number4: "贵州妞妞交通运输公司",
        //   number5: "15426333562",
        //   number6: "张三",
        //   number7: "通过",
        //   number8: "A1",
        //   number9: "95分",
        //   number16: "2019.11.28-14.:25",
        // }, {
        //   status: "待受理",
        //   number1: "张登",
        //   number2: "18888888888",
        //   number3: "男",
        //   number4: "贵州妞妞交通运输公司",
        //   number5: "15426333562",
        //   number6: "张三",
        //   number7: "通过",
        //   number8: "A1",
        //   number9: "95分",
        //   number16: "2019.11.28-14.:25",
        // }, {
        //   status: "待受理",
        //   number1: "张登",
        //   number2: "18888888888",
        //   number3: "男",
        //   number4: "贵州妞妞交通运输公司",
        //   number5: "15426333562",
        //   number6: "张三",
        //   number7: "通过",
        //   number8: "A1",
        //   number9: "95分",
        //   number16: "2019.11.28-14.:25",
        // },
      ]
    };
  },
  created() {},
  mounted() {
    this.query(1,10,1)
  },
  methods: {
    query(type,size,page) {
      apiDriverList({
        name: type==1?'':this.name,
        status: '',
        pageSize: size,
        pageNumber: page,
      })
        .then(res => {
          this.tableData = res.data.records;
        })
        .catch(error => {
          console.log(error);
        });
    },
    // 查看证件
    handleClick(val) {
      console.log(val);
      this.dialogTableVisible = true;
      this.imgUrl = val;
    },
    // 清空
    resetForm(formName) {
      // this.$refs[formName].resetFields();
      // this.ruleForm.number = ''
      // this.ruleForm.value = ''
      // this.ruleForm.value2 = ''
      // this.ruleForm.time = ''
      // this.ruleForm.time2 = ''
    }
  }
};
</script>

<style lang="scss" scoped>
#drivermanage {
  min-height: 100%;
  background-color: #fff;
  padding: 24px;
  box-sizing: border-box;
  .tableDetail span {
    line-height: 35px;
  }
  .dialog .price {
    color: $red;
  }
}
</style>
